package models

import (
	"strings"
)

//批量添加职位
func AddPosition(dataList []map[string]string, city, types string) error {
	sql := "INSERT INTO `wx`.`wx_position` (`position`, `min_wages`, `address`, `workingYear`, `education`, `company`, `company_people`, `financing_detail`, `created_time`, `city`, `type`, `max_wages`, `url`) VALUES "
	for _, position := range dataList {
		sql += "('" + position["position"] + "','"
		sql += position["min_wages"] + "','"
		sql += position["address"] + "','"
		sql += position["workingYear"] + "','"
		sql += position["education"] + "','"
		sql += position["company"] + "','"
		sql += position["company_people"] + "','"
		sql += position["financing_detail"] + "','"
		sql += position["created_time"] + "','"
		sql += city + "','"
		sql += types + "','"
		sql += position["max_wages"] + "','"
		sql += position["url"] + "'),"
	}

	sql = strings.TrimRight(sql, ",")

	db.Exec(sql)

	return nil

}
